package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.ShoppingCart;
import com.itheima.reggie.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.List;

@Mapper
public interface UserMapper {
    @Select("SELECT * FROM user WHERE phone =#{phone}")
    User findByPhone(String phone);

    @Insert("INSERT INTO user(phone,status) VALUES (#{phone},#{status})")
    @Options(useGeneratedKeys = true,keyColumn = "id",keyProperty = "id")
    void save(User dbuser);


    @Select("SELECT * FROM user WHERE id =#{id}")
    User findByUserId(Long userId);
}
